package per.kongtouxu.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import per.kongtouxu.domain.pojo.User;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
public class PageController {
     @RequestMapping("/page")
    public String pager(HttpServletRequest req, HttpServletResponse resp) {
         //获取前台发送过来的参数
         String p = req.getParameter("p");
         System.out.println("p:"+p);
         if(p==null){
             return "index";
         }else if(p.equals("Login") || p.equals("Register") || p.equals("index")){
             return p;
         } else {
             User userInfo = (User) req.getSession().getAttribute("loginUser");
             if(userInfo != null){
                 return p;
             }else {
                 return "Login";
             }
         }
    }
}
